package com.bs.bookshare.controller;

import com.bs.bookshare.Mapper.BookMapper;
import com.bs.bookshare.common.Resp;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import static com.bs.bookshare.common.Resp.ok;

@Controller
public class TestAction {

    @Autowired
    public BookMapper number;

    //返回数据库中全部书籍的数目
    @ResponseBody
    @PostMapping("/getBooksNumber")
    public Resp getBooksnumber() {
        int booksNumber = number.getBooksNumber();
        return ok().data("totalbook",booksNumber);
    }
}
